﻿Imports Microsoft.VisualBasic
Imports JPC.Medialibrary.BLL
Imports SubSonic

Namespace JPC.Medialibrary.DAL
    Partial Public Class Album

        Private _artistId As Integer
        Private _artistName As String

        Public Property ArtistId() As Integer
            Get
                Return _artistId
            End Get
            Set(ByVal value As Integer)
                _artistId = value
            End Set
        End Property

        Public Property ArtistName() As String
            Get
                If _artistName = "" Then
                    Dim list As List(Of Artist) = MedialibraryManager.GetArtistsByAlbum(Me.AlbumId)
                    If list.Count > 1 Then
                        _artistName = "Varios"
                    Else
                        _artistName = MedialibraryManager.ProperName(list(0).ArtistName)
                    End If
                End If
                Return _artistName
            End Get
            Set(ByVal value As String)
                _artistName = value
            End Set
        End Property


        Public ReadOnly Property AlbumNameProper() As String
            Get
                Return MedialibraryManager.ProperName(Me.AlbumName)
            End Get
        End Property

    End Class
End Namespace
